import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/about",
    name: "about",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  },
  {
    path: "/main",
    name: "main",
    component: () =>
        import("../views/MainView.vue"),
    children: [
      {
        path: "/search",
        name: "search",
        component: () =>
            import("../components/FileSearch.vue")
      },
      {
        path: "/list",
        name: "fileList",
        component: () =>
            import("../components/FileList.vue")
      }
    ]
  },
  {
    path: "/",
    name: "",
    component: () =>
        import("../views/LoginView.vue")
  },
  {
    path: '*',
    name: '404',
    component: () =>
        import('../views/404View.vue')
  }
];

const router = new VueRouter({
  routes,
});

export default router;
